<h1> Add Answers </h1>
<% if @fail %>
  <div id="error_explanation">
    <h2><%= pluralize(@fail.length, "error") %> prohibited this quiz from being saved:</h2>
    <ul>
      <% @fail.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
    </ul>

  </div>
<% end %>
<h4>Question Title: </h4>
<%= @question.title %>
<h4>Question Body: </h4>
<%= @question.body %>
<h4>Question Type: </h4>
<%= @question.anstype%>

<h4>Answers: </h4>
<% @question.answers.order("spot ASC").each do |a| %>
  <p>
    Answer #<%= a.spot %>
    <br />
    Body:
    <%= a.body %>
    <br />
    Score:
    <%= a.score %>
    <br />
    <%= link_to "Delete Answer" , :action => :deleteanswer, :id => a.id, :questionid => @question.id %>
    <%= link_to "Move Up" , :action => :moveupanswer, :questionid => @question.id, :spot => a.spot, :up => true %>
    <%= link_to "Move Down" , :action => :moveupanswer, :questionid => @question.id, :spot => a.spot, :up => false %>
  </p>
<% end %>


<%= form_for(:answer, @question.answers.build, :url => { :action => "createanswer", :questionid => @question.id }) do |a| %>


  <div class="field">
    <h5>New Answer</h5>
    <p>Body:</p>
    <%= a.text_field :body %>
  </div>

  <div class="field">
    <p>Score:</p>
    <%= a.text_field :score %>
  </div>


  <div class="actions">
    <%= a.submit %>
  </div>
<% end %>

<div>
  <%= link_to("Finish", :action => :editquiz ,:quiz_id => session[:quiz_id]) %>
</div>